let t = require;
let  e = module
let  o =  e.exports;
 o.default =  e.exports;

                'use strict';
                console.log("start");
                var _n32,
                    i =
                    (this && this.__extends) ||
                    ((_n32 = function n(t, e) {
                            return (_n32 =
                                Object.setPrototypeOf ||
                                ({
                                        __proto__: []
                                    }
                                    instanceof Array &&
                                    function(t, e) {
                                        t.__proto__ = e;
                                    }) ||
                                function(t, e) {
                                    for (var o in e) {
                                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                                    }
                                })(t, e);
                        }),
                        function(t, e) {
                            function o() {
                                this.constructor = t;
                            }
                            _n32(t, e),
                                (t.prototype =
                                    null === e ?
                                    Object.create(e) :
                                    ((o.prototype = e.prototype), new o()));
                        }),
                    r =
                    (this && this.__decorate) ||
                    function(t, e, o, n) {
                        var i,
                            r = arguments.length,
                            a =
                            r < 3 ?
                            e :
                            null === n ?
                            (n = Object.getOwnPropertyDescriptor(e, o)) :
                            n;
                        if (
                            'object' ==
                            (typeof Reflect === 'undefined' ?
                                'undefined' :
                                typeof(Reflect)) &&
                            'function' == typeof Reflect.decorate
                        )
                            a = Reflect.decorate(t, e, o, n);
                        else
                            for (var s = t.length - 1; s >= 0; s--) {
                                (i = t[s]) &&
                                (a = (r < 3 ? i(a) : r > 3 ? i(e, o, a) : i(e, o)) || a);
                            }
                        return r > 3 && a && Object.defineProperty(e, o, a), a;
                    };
                Object.defineProperty(o, '__esModule', {
                        value: !0
                    }),
                    (o.BagMrg = void 0);
                var a = t('ItemInfo'),
                    s = t('AbsObject'),
                    c = cc._decorator,
                    l = c.ccclass,
                    u =
                    (c.property,
                        (function(t) {
                            function e() {
                                return t.call(this) || this;
                            }
                            var o;
                            return (
                                i(e, t),
                                (o = e),
                                (e.getCountChangeEventName = function(t) {
                                    return o.ItemCountChanged + t;
                                }),
                                Object.defineProperty(e, 'ins', {
                                    get: function get() {
                                        return null == o._ins && (o._ins = new o()), this._ins;
                                    },
                                    enumerable: !1,
                                    configurable: !0
                                }),
                                (e.prototype.init = function(t) {
                                    for (var e in ((this._items = []), t)) {
                                        var n = t[e],
                                            i = new a.ItemInfo(n.id, n.count);
                                        this._items.push(i);
                                    }
                                    this.sortItems(), this.emit(o.BagChanged);
                                }),
                                (e.prototype.newDay = function() {}),
                                (e.prototype.addCountEvent = function(t, e, n) {
                                    this.on(o.ItemCountChanged + t, e, n);
                                }),
                                (e.prototype.removeCountEvent = function(t, e, n) {
                                    this.off(o.ItemCountChanged + t, e, n);
                                }),
                                (e.prototype.addDiamond = function(t) {
                                    this.addItem(o.DIAMOND, t);
                                }),
                                (e.prototype.addGold = function(t) {
                                    this.addItem(o.GOLD, t);
                                }),
                                (e.prototype.getData = function() {
                                    for (var t = {}, e = 0; e < this._items.length; e++) {
                                        var o = this._items[e];
                                        t[e] = {
                                            id: o.id,
                                            count: o.count
                                        };
                                    }
                                    return t;
                                }),
                                (e.prototype.__addItem = function(t, e) {
                                    void 0 === e && (e = 1);
                                    var n = this.getItem(t);
                                    null == n && ((n = new a.ItemInfo(t)), this._items.push(n)),
                                        (n.count += e),
                                        this.emit(o.getCountChangeEventName(t), n.count, t);
                                }),
                                (e.prototype.addItem = function(t, e) {
                                    void 0 === e && (e = 1),
                                        this.__addItem(t, e),
                                        this.sortItems(),
                                        this.emit(o.BagChanged);
                                }),
                                (e.prototype.addItems = function(t) {
                                    for (var e = 0; e < t.length; e++) {
                                        var n = t[e];
                                        this.__addItem(n[0], n[1]);
                                    }
                                    this.sortItems(), this.emit(o.BagChanged);
                                }),
                                (e.prototype.useItem = function(t, e) {
                                    if ((void 0 === e && (e = 1), e > 0)) {
                                        var n = this.getItem(t);
                                        n &&
                                            ((n.count -= e),
                                                n.count <= 0 && n.isVisible && this.removeItem(n),
                                                this.emit(
                                                    o.getCountChangeEventName(t),
                                                    this.getCount(t),
                                                    t
                                                ),
                                                this.emit(o.BagChanged));
                                    }
                                }),
                                (e.prototype.getCount = function(t) {
                                    var e = this.getItem(t);
                                    return e ? e.count : 0;
                                }),
                                (e.prototype.getItem = function(t) {
                                    for (var e = 0; e < this._items.length; e++) {
                                        var o = this._items[e];
                                        if (o.id == t) return o;
                                    }
                                    return null;
                                }),
                                (e.prototype.removeItem = function(t) {
                                    for (var e = 0; e < this._items.length; e++) {
                                        if (this._items[e] == t)
                                            return void this._items.splice(e, 1);
                                    }
                                }),
                                (e.prototype.sortItems = function() {
                                    this._items.sort(function(t, e) {
                                        return t.id - e.id;
                                    });
                                }),
                                (e.BagChanged = 'Evt_Bag_Changed'),
                                (e.ItemCountChanged = 'Evt_Bag_ItemCountChanged_'),
                                (e.GOLD = 1),
                                (e.DIAMOND = 2),
                                (e.ERADICATE = 1001),
                                (e.SWAP = 1002),
                                (o = r([l('BagMrg')], e))
                            );
                        })(s.AbsObject));
                (o.BagMrg = u), console.log("end");
            module.exports =  e.exports;